home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cgraphix / cmovwind.c < prev    next >
Text File  |  1986-05-28  |  1KB  |  84 lines

  1. /* «RM120»«PL99999»«TS4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76» */
  2. #include    <stdio.h>
  3. #define    EXTERN    extern
  4. #include    <typedef.h>
  5.  
  6.  
  7. void DrawLines()
  8. {
  9.     int    i;
  10.  
  11.     for (i = 1; i <= 20; i++)
  12.         DrawLine(50.*i, 0., 1000.-50.*i, 50.*i);
  13. }
  14.  
  15.  
  16. main()
  17. {
  18.     int        i;
  19.     int        key;
  20.  
  21.     InitGraphic();                /* init the system and screen    */
  22.     DrawBorder();
  23.  
  24.     DefineWindow(1, (int)(XMaxGlb/10), (int)(YMaxGlb/10),
  25.         (int)(XMaxGlb/2), (int)(YMaxGlb/2));
  26.     DefineHeader(1, "THIS IS THE FIXED WINDOW");
  27.     DefineWorld(1, 0., 0., 1000., 1000.);
  28.  
  29.     DefineWindow(2, (int)(XMaxGlb/2), (int)(YMaxGlb/2),
  30.         (int)(9 * XMaxGlb/10), (int)(9*YMaxGlb/10));
  31.     DefineHeader(2, "THIS IS THE MOVEABLE WINDOW");
  32.     DefineWorld(2, 0., 0., 1000., 1000.);
  33.  
  34.     SelectWorld(1);
  35.     SelectWindow(1);
  36.     SetHeaderOn();
  37.     SetBackground(0);
  38.     DrawBorder();
  39.     DrawLines();
  40.     CopyScreen();
  41.     SetBreakOff();
  42.     SetMessageOff();
  43.  
  44.     SelectWorld(2);
  45.     SelectWindow(2);
  46.     SetHeaderOn();
  47.     SetBackground(0);
  48.     DrawBorder();
  49.     DrawLines();
  50.     VStepGlb = 2;
  51.  
  52.     while (1) {
  53.         key = 0;
  54.         key = inkey();
  55.         fflush(stdin);
  56.         switch(key) {
  57.             case '8':
  58.             case -72:
  59.                 MoveVer(-4, TRUE);
  60.                 break;
  61.             case '4':
  62.             case -75:
  63.                 MoveHor(-1, TRUE);
  64.                 break;
  65.             case '6':
  66.             case -77:
  67.                 MoveHor(1, TRUE);
  68.                 break;
  69.             case '2':
  70.             case -80 :
  71.                 MoveVer(4, TRUE);
  72.                 break;
  73.             case ' ':
  74.                 LeaveGraphic();
  75.                 exit(1);
  76.                 break;
  77.             default:
  78.                 break;
  79.         }
  80.     }
  81.  
  82. }
  83.  
  84.